$(function(){
	$('#errlogt').datagrid({
		title:'日志列表',
		fit:true ,
		fitColumns : true,
		border : false,
		pagination : true,
		idField : 'logId',
		rownumbers : true,
		singleSelect:true,
		pagination:true,
		rownumbers:true,
		sortName: 'logErrtime',
		sortOrder: 'desc',
		remoteSort: true,
		striped: true,
		frozenColumns:[[
            {title:'日志标识',field:'logId',sortable:true}
		]],
		url:ctx+'/errLogManager/listErrLogs',
		columns:[[
			{field:'logErrtime',title:'发生时间',width:getWidth(6),sortable:true,
				formatter:function(value){
					var ss="";
					if(value!=null){
						ss=formatTimeStampDate(value);
					}
					return ss;
				}	
			},
			{field:'logErrmodel',title:'错误模块',width:getWidth(6),sortable:true},
			{field:'logAppip',title:'调用者IP',width:getWidth(6),sortable:true},
			{field:'logFilename',title:'文件名称',width:getWidth(6),sortable:true},
			{field:'logErrmsg',title:'错误信息',width:getWidth(6),sortable:true}
		]]
	});
	
	// 添加easyui日期插件
	$('#logErrtimeStart').datebox({
		formatter : function(date) {
			var y = date.getFullYear();
			var m = date.getMonth() + 1;
			var d = date.getDate();
			return y + '-' + m + '-' + d;
		}
	});
	$('#logErrtimeEnd').datebox({
		formatter : function(date) {
			var y = date.getFullYear();
			var m = date.getMonth() + 1;
			var d = date.getDate();
			return y + '-' + m + '-' + d;
		}
	});
	// 设置日期只读
	$(".datebox :text").attr("readonly", "readonly");
});


//js方法：序列化表单 			
function serializeForm(form){
	var obj = {};
	$.each(form.serializeArray(),function(index){
		if(obj[this['name']]){
			obj[this['name']] = obj[this['name']] + ','+this['value'];
		} else {
			obj[this['name']] =this['value'];
		}
	});
	return obj;
}

/**
 * 分页模糊查询
 */
function searchFdfs(){
	$('#errlogt').datagrid("clearChecked");
	$('#errlogt').datagrid('load' ,serializeForm($('#errlogform')));	    
}
/**
 * 重置账号管理查询表单
 */
function clearForm(){
	$('#errlogform').form('clear');
}